import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;

public class User {

	public User(SelectionKey selectionKey, SocketChannel socketChannel) {
		this.selectionKey = selectionKey;
		this.socketChannel = socketChannel;
	}

	private SelectionKey selectionKey;
	private SocketChannel socketChannel;

	private boolean gameCreated;

	public void send(String str) throws IOException {
		try {
			socketChannel.write(ByteBuffer.wrap((str + "\r\n").getBytes()));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public SelectionKey getSelectionKey() {
		return selectionKey;
	}

	public SocketChannel getSocketChannel() {
		return socketChannel;
	}

	public boolean isGameCreated() {
		return gameCreated;
	}

	public void setGameCreated(boolean gameCreated) {
		this.gameCreated = gameCreated;
	}
}
